<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>highlight.lua</title>
<meta name="generator" content="KF5::SyntaxHighlighting (Lua)"/>
</head><body style="color:#1f1c1b"><pre>
<span style="color:#898887;">#!/usr/bin/env lua</span>

<span style="color:#898887;">-- Metatables</span>
<span style="color:#5555ff;">t</span> = {
    <span style="color:#644a9b;font-weight:bold;">__add</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">a</span>,<span style="color:#5555ff;">b</span>)<span style="color:#a1a100;">return</span> <span style="color:#5555ff;">a</span>+<span style="color:#5555ff;">b</span> <span style="font-weight:bold;">end</span>,
    <span style="color:#644a9b;font-weight:bold;">__sub</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">a</span>,<span style="color:#5555ff;">b</span>)<span style="color:#a1a100;">return</span> <span style="color:#5555ff;">a</span>-<span style="color:#5555ff;">b</span> <span style="font-weight:bold;">end</span>,
    <span style="color:#644a9b;font-weight:bold;">__mul</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">a</span>,<span style="color:#5555ff;">b</span>)<span style="color:#a1a100;">return</span> <span style="color:#5555ff;">a</span>*<span style="color:#5555ff;">b</span> <span style="font-weight:bold;">end</span>,
    <span style="color:#644a9b;font-weight:bold;">__div</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">a</span>,<span style="color:#5555ff;">b</span>)<span style="color:#a1a100;">return</span> <span style="color:#5555ff;">a</span>/<span style="color:#5555ff;">b</span> <span style="font-weight:bold;">end</span>,
    <span style="color:#644a9b;font-weight:bold;">__mod</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">a</span>,<span style="color:#5555ff;">b</span>)<span style="color:#a1a100;">return</span> <span style="color:#5555ff;">a</span>%<span style="color:#5555ff;">b</span> <span style="font-weight:bold;">end</span>,
    <span style="color:#644a9b;font-weight:bold;">__pow</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">a</span>,<span style="color:#5555ff;">b</span>)<span style="color:#a1a100;">return</span> <span style="color:#5555ff;">a</span>^<span style="color:#5555ff;">b</span> <span style="font-weight:bold;">end</span>,
    <span style="color:#644a9b;font-weight:bold;">__unm</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">a</span>)<span style="color:#a1a100;">return</span> -<span style="color:#5555ff;">a</span> <span style="font-weight:bold;">end</span>,
    <span style="color:#644a9b;font-weight:bold;">__idiv</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">a</span>,<span style="color:#5555ff;">b</span>)<span style="color:#a1a100;">return</span> <span style="color:#5555ff;">a</span>//<span style="color:#5555ff;">b</span> <span style="font-weight:bold;">end</span>,
    <span style="color:#644a9b;font-weight:bold;">__band</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">a</span>,<span style="color:#5555ff;">b</span>)<span style="color:#a1a100;">return</span> <span style="color:#5555ff;">a</span>&amp;<span style="color:#5555ff;">b</span> <span style="font-weight:bold;">end</span>,
    <span style="color:#644a9b;font-weight:bold;">__bor</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">a</span>,<span style="color:#5555ff;">b</span>)<span style="color:#a1a100;">return</span> <span style="color:#5555ff;">a</span>|<span style="color:#5555ff;">b</span> <span style="font-weight:bold;">end</span>,
    <span style="color:#644a9b;font-weight:bold;">__bxor</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">a</span>,<span style="color:#5555ff;">b</span>)<span style="color:#a1a100;">return</span> <span style="color:#5555ff;">a</span>~<span style="color:#5555ff;">b</span> <span style="font-weight:bold;">end</span>,
    <span style="color:#644a9b;font-weight:bold;">__bnot</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">a</span>)<span style="color:#a1a100;">return</span> ~<span style="color:#5555ff;">a</span> <span style="font-weight:bold;">end</span>,
    <span style="color:#644a9b;font-weight:bold;">__shl</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">a</span>,<span style="color:#5555ff;">b</span>)<span style="color:#a1a100;">return</span> <span style="color:#5555ff;">a</span>&lt;&lt;<span style="color:#5555ff;">b</span> <span style="font-weight:bold;">end</span>,
    <span style="color:#644a9b;font-weight:bold;">__shr</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">a</span>,<span style="color:#5555ff;">b</span>)<span style="color:#a1a100;">return</span> <span style="color:#5555ff;">a</span>&gt;&gt;<span style="color:#5555ff;">b</span> <span style="font-weight:bold;">end</span>,
    <span style="color:#644a9b;font-weight:bold;">__concat</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">a</span>,<span style="color:#5555ff;">b</span>)<span style="color:#a1a100;">return</span> <span style="color:#5555ff;">a</span>..<span style="color:#5555ff;">b</span> <span style="font-weight:bold;">end</span>,
    <span style="color:#644a9b;font-weight:bold;">__len</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">a</span>)<span style="color:#a1a100;">return</span> #<span style="color:#5555ff;">a</span> <span style="font-weight:bold;">end</span>,
    <span style="color:#644a9b;font-weight:bold;">__eq</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">a</span>,<span style="color:#5555ff;">b</span>)<span style="color:#a1a100;">return</span> <span style="color:#5555ff;">a</span>==<span style="color:#5555ff;">b</span> <span style="font-weight:bold;">end</span>,
    <span style="color:#644a9b;font-weight:bold;">__lt</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">a</span>,<span style="color:#5555ff;">b</span>)<span style="color:#a1a100;">return</span> <span style="color:#5555ff;">a</span>&lt;<span style="color:#5555ff;">b</span> <span style="font-weight:bold;">end</span>,
    <span style="color:#644a9b;font-weight:bold;">__le</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">a</span>,<span style="color:#5555ff;">b</span>)<span style="color:#a1a100;">return</span> <span style="color:#5555ff;">a</span>&lt;=<span style="color:#5555ff;">b</span> <span style="font-weight:bold;">end</span>,
    <span style="color:#644a9b;font-weight:bold;">__index</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">t</span>,<span style="color:#5555ff;">k</span>)<span style="color:#a1a100;">return</span> <span style="color:#5555ff;">t</span>[<span style="color:#5555ff;">k</span>] <span style="font-weight:bold;">end</span>,
    <span style="color:#644a9b;font-weight:bold;">__newindex</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">t</span>,<span style="color:#5555ff;">k</span>,<span style="color:#5555ff;">v</span>)<span style="color:#a1a100;">return</span> <span style="color:#5555ff;">t</span>[<span style="color:#5555ff;">k</span>]=<span style="color:#5555ff;">v</span> <span style="font-weight:bold;">end</span>,
    <span style="color:#644a9b;font-weight:bold;">__call</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">f</span>, ...)<span style="color:#a1a100;">return</span> f(...) <span style="font-weight:bold;">end</span>,

   <span style="color:#644a9b;font-weight:bold;">__tostring</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">a</span>)<span style="color:#a1a100;">return</span> <span style="color:#644a9b;">tostring</span>(<span style="color:#5555ff;">a</span>) <span style="font-weight:bold;">end</span>,
   <span style="color:#644a9b;font-weight:bold;">__pairs</span>=<span style="font-weight:bold;">function</span>(<span style="color:#5555ff;">t</span>)<span style="color:#a1a100;">return</span> <span style="color:#644a9b;">pairs</span>(<span style="color:#5555ff;">a</span>) <span style="font-weight:bold;">end</span>,
   <span style="color:#898887;">-- setmetatable</span>
   <span style="color:#644a9b;font-weight:bold;">__metatable</span>=<span style="font-weight:bold;">true</span>
   <span style="color:#898887;">-- Garbage collector</span>
   <span style="color:#644a9b;font-weight:bold;">__gc</span>=<span style="font-weight:bold;">function</span>() <span style="font-weight:bold;">end</span>
   <span style="color:#898887;">-- Weak table</span>
   <span style="color:#644a9b;font-weight:bold;">__mode</span>=<span style="color:#bf0303;">'k'</span> <span style="color:#898887;">-- or 'v'</span>
}

<span style="color:#5555ff;">a</span> <span style="font-weight:bold;">or</span> <span style="color:#5555ff;">b</span>
<span style="color:#5555ff;">a</span> <span style="font-weight:bold;">and</span> <span style="color:#5555ff;">b</span>
<span style="color:#5555ff;">a</span>~=<span style="color:#5555ff;">b</span>
<span style="color:#5555ff;">a</span>&gt;=<span style="color:#5555ff;">b</span>
<span style="font-weight:bold;">true</span> <span style="font-weight:bold;">or</span> <span style="font-weight:bold;">false</span>
<span style="color:#5555ff;">a</span> <span style="font-weight:bold;">or</span> <span style="font-weight:bold;">nil</span>
<span style="color:#5555ff;">a</span>::<span style="color:#5555ff;">m</span>
<span style="color:#5555ff;">a</span>.<span style="color:#5555ff;">m</span>
<span style="color:#5555ff;">a</span>;<span style="color:#5555ff;">a</span>


<span style="color:#898887;">-- String</span>
<span style="color:#bf0303;">'</span><span style="color:#3daee9;">\a</span><span style="color:#bf0303;">'</span>
<span style="color:#bf0303;">'</span><span style="color:#3daee9;">\b</span><span style="color:#bf0303;">'</span>
<span style="color:#bf0303;">'</span><span style="color:#3daee9;">\f</span><span style="color:#bf0303;">'</span>
<span style="color:#bf0303;">'</span><span style="color:#3daee9;">\n</span><span style="color:#bf0303;">'</span>
<span style="color:#bf0303;">'</span><span style="color:#3daee9;">\r</span><span style="color:#bf0303;">'</span>
<span style="color:#bf0303;">'</span><span style="color:#3daee9;">\t</span><span style="color:#bf0303;">'</span>
<span style="color:#bf0303;">'</span><span style="color:#3daee9;">\v</span><span style="color:#bf0303;">'</span>
<span style="color:#bf0303;">'</span><span style="color:#3daee9;">\\</span><span style="color:#bf0303;">'</span>
<span style="color:#bf0303;">'</span><span style="color:#3daee9;">\&quot;</span><span style="color:#bf0303;">'</span>
<span style="color:#bf0303;">'</span><span style="color:#3daee9;">\'</span><span style="color:#bf0303;">'</span>
<span style="color:#bf0303;">'</span><span style="color:#3daee9;">\z</span><span style="color:#bf0303;">'</span>
<span style="color:#bf0303;">'</span><span style="color:#3daee9;">\xff</span><span style="color:#bf0303;">'</span>
<span style="color:#bf0303;">'</span><span style="color:#3daee9;">\xFF</span><span style="color:#bf0303;">'</span>
<span style="color:#bf0303;">'</span><span style="color:#3daee9;">\231</span><span style="color:#bf0303;">'</span>
<span style="color:#bf0303;">'</span><span style="color:#3daee9;">\23</span><span style="color:#bf0303;">'</span>
<span style="color:#bf0303;">'</span><span style="color:#3daee9;">\2</span><span style="color:#bf0303;">'</span>
<span style="color:#bf0303;">'</span><span style="color:#3daee9;">\u{100201}</span><span style="color:#bf0303;">'</span> <span style="color:#898887;">-- max 6 digits</span>
<span style="color:#bf0303;">'</span><span style="color:#3daee9;">\2</span><span style="color:#bf0303;">a</span><span style="color:#bf0303;text-decoration:underline;">\</span><span style="color:#bf0303;">ks'</span> <span style="color:#898887;">-- error</span>

<span style="color:#bf0303;">'multi</span><span style="color:#3daee9;">\</span>
<span style="color:#bf0303;">line'</span>
<span style="color:#bf0303;">'multi</span><span style="color:#3daee9;">\z</span>
<span style="color:#bf0303;">line'</span>
<span style="color:#bf0303;">'multi</span><span style="color:#3daee9;">\z</span><span style="color:#bf0303;">    line</span><span style="color:#3daee9;">\</span>
<span style="color:#bf0303;">2'</span>

<span style="color:#5555ff;">a</span> = <span style="color:#bf0303;">'alo</span><span style="color:#3daee9;">\n</span><span style="color:#bf0303;">123&quot;'</span>
<span style="color:#5555ff;">a</span> = <span style="color:#bf0303;">&quot;alo</span><span style="color:#3daee9;">\n</span><span style="color:#bf0303;">123</span><span style="color:#3daee9;">\&quot;</span><span style="color:#bf0303;">&quot;</span>
<span style="color:#5555ff;">a</span> = <span style="color:#bf0303;">'</span><span style="color:#3daee9;">\97</span><span style="color:#bf0303;">lo</span><span style="color:#3daee9;">\10\049</span><span style="color:#bf0303;">23&quot;'</span>
<span style="color:#5555ff;">a</span> = <span style="color:#bf0303;">[[alo</span>
<span style="color:#bf0303;">123&quot;]]</span>
<span style="color:#5555ff;">a</span> = <span style="color:#bf0303;">[==[</span>
<span style="color:#bf0303;">alo</span>
<span style="color:#bf0303;">123&quot;]==]</span>


<span style="color:#898887;">-- Decimal</span>
<span style="color:#b08000;">3</span>
<span style="color:#b08000;">345</span>
<span style="color:#b08000;">0xff</span>
<span style="color:#b08000;">0xBEBADA</span>

<span style="color:#898887;">-- Float</span>
<span style="color:#b08000;">3.</span>
<span style="color:#b08000;">.3</span>
<span style="color:#b08000;">3.0</span>
<span style="color:#b08000;">3.1416</span>
<span style="color:#b08000;">314.16e-2</span>
<span style="color:#b08000;">314.e+2</span>
<span style="color:#b08000;">0.31416E1</span>
<span style="color:#b08000;">34e1</span>
<span style="color:#b08000;">0.e3</span>
<span style="color:#b08000;">0x0.1E</span>
<span style="color:#b08000;">0xA23p-4</span>
<span style="color:#b08000;">0xA.p+4</span>
<span style="color:#b08000;">0x.ap4</span>
<span style="color:#b08000;">0X1.921FB54442D18P+1</span>
<span style="color:#898887;">-- error</span>
<span style="color:#b08000;">32</span>p
<span style="color:#b08000;">0</span>xp-<span style="color:#b08000;">4</span>
<span style="color:#b08000;">0</span>x.<span style="color:#5555ff;">p</span>-<span style="color:#b08000;">4</span>


<span style="color:#898887;">-- single comment</span>
xyz()
<span style="color:#898887;">--[[</span>
<span style="color:#898887;"> long comment</span>
<span style="color:#898887;">]]</span>
xyz()


<span style="color:#5555ff;">a</span> = { [f(<span style="color:#b08000;">1</span>)] = <span style="color:#5555ff;">g</span>; <span style="color:#bf0303;">&quot;x&quot;</span>, <span style="color:#bf0303;">&quot;y&quot;</span>; <span style="color:#5555ff;">x</span> = <span style="color:#b08000;">1</span>, f(<span style="color:#5555ff;">x</span>), [<span style="color:#b08000;">30</span>] = <span style="color:#b08000;">23</span>; <span style="color:#b08000;">45</span> }

<span style="color:#898887;">-- is equivalent to</span>

<span style="color:#a1a100;">do</span>
  <span style="font-weight:bold;">local</span> <span style="color:#5555ff;">t</span> = {}
  <span style="color:#5555ff;">t</span>[f(<span style="color:#b08000;">1</span>)] = <span style="color:#5555ff;">g</span>
  <span style="color:#5555ff;">t</span>[<span style="color:#b08000;">1</span>] = <span style="color:#bf0303;">&quot;x&quot;</span> <span style="color:#898887;">-- 1st exp</span>
  <span style="color:#5555ff;">t</span>[<span style="color:#b08000;">2</span>] = <span style="color:#bf0303;">&quot;y&quot;</span> <span style="color:#898887;">-- 2nd exp</span>
  <span style="color:#5555ff;">t</span>.<span style="color:#5555ff;">x</span> = <span style="color:#b08000;">1</span> <span style="color:#898887;">-- t[&quot;x&quot;] = 1</span>
  <span style="color:#5555ff;">t</span>[<span style="color:#b08000;">3</span>] = f(<span style="color:#5555ff;">x</span>) <span style="color:#898887;">-- 3rd exp</span>
  <span style="color:#5555ff;">t</span>[<span style="color:#b08000;">30</span>] = <span style="color:#b08000;">23</span>
  <span style="color:#5555ff;">t</span>[<span style="color:#b08000;">4</span>] = <span style="color:#b08000;">45</span> <span style="color:#898887;">-- 4th exp</span>
  <span style="color:#5555ff;">a</span> = <span style="color:#5555ff;">t</span>
<span style="color:#a1a100;">end</span>

<span style="color:#b08000;">32</span>-<span style="color:#b08000;">0x43</span>+<span style="color:#b08000;">0x2</span>-<span style="color:#b08000;">5</span>
<span style="color:#a1a100;">return</span><span style="color:#bf0303;">&quot;a&quot;</span>
<span style="color:#a1a100;">return</span><span style="color:#bf0303;">'a'</span>
<span style="color:#a1a100;">return</span>{}
f(<span style="color:#b08000;">3</span>)
f<span style="color:#bf0303;">'a'</span>
f<span style="color:#bf0303;">&quot;a&quot;</span>
f{<span style="color:#5555ff;">s</span>=<span style="color:#b08000;">2</span>}
f<span style="color:#bf0303;">[[s]]</span>
f<span style="color:#bf0303;">[=[s]=]</span>
#<span style="color:#5555ff;">a</span>

<span style="font-weight:bold;">local</span> <span style="color:#aa5500;">CONSTANT</span> = <span style="color:#5555ff;">a</span>

<span style="color:#5555ff;">a</span> = {}
<span style="font-weight:bold;">local</span> <span style="color:#5555ff;">x</span> = <span style="color:#b08000;">20</span>
<span style="color:#a1a100;">for</span> <span style="color:#5555ff;">i</span>=<span style="color:#b08000;">1</span>,<span style="color:#b08000;">10</span> <span style="color:#a1a100;">do</span>
  <span style="font-weight:bold;">local</span> <span style="color:#5555ff;">y</span> = <span style="color:#b08000;">0</span>
  <span style="color:#5555ff;">a</span>[<span style="color:#5555ff;">i</span>] = <span style="font-weight:bold;">function</span> () <span style="color:#5555ff;">y</span>=<span style="color:#5555ff;">y</span>+<span style="color:#b08000;">1</span>; <span style="color:#a1a100;">return</span> <span style="color:#5555ff;">x</span>+<span style="color:#5555ff;">y</span> <span style="font-weight:bold;">end</span>
<span style="color:#a1a100;">end</span>

<span style="color:#898887;">--! </span><span style="color:#ca60ca;font-weight:bold;">\brief</span><span style="color:#898887;"> gfind is deprecated</span>
<span style="color:#bf0303;text-decoration:underline;">string.gfind</span>(<span style="color:#bf0303;">'s'</span>)
<span style="color:#644a9b;">string.gmatch</span>(<span style="color:#bf0303;">'f'</span>)

<span style="font-weight:bold;">function</span> foo()
  <span style="color:#a1a100;">if</span> <span style="color:#5555ff;">x</span> <span style="color:#a1a100;">then</span>
    <span style="font-weight:bold;">function</span>() <span style="font-weight:bold;">end</span>
    <span style="color:#5555ff;">bar</span>=<span style="font-weight:bold;">function</span>()
      <span style="color:#a1a100;">if</span> <span style="color:#5555ff;">y</span> <span style="color:#a1a100;">then</span>
        <span style="color:#a1a100;">if</span> <span style="color:#5555ff;">z</span> <span style="color:#a1a100;">then</span> <span style="color:#a1a100;">end</span>
      <span style="color:#a1a100;">end</span>
    <span style="font-weight:bold;">end</span>
  <span style="color:#a1a100;">end</span>
<span style="font-weight:bold;">end</span>
</pre></body></html>
